<%@ page contentType="text/html;charset=utf-8"%>
<%@ page
	import="java.io.*, java.sql.*, java.util.*, java.text.*, napal.*, util.*, napal.*"%>
<%@ page import="org.apache.ibatis.*"%>
<%@ page import="java.util.Date"%>
<%
	request.setCharacterEncoding("utf-8");
%>

<%@ include file="./Header.jsp"%>
</td>
</TR>
<TR HEIGHT="100">
	<td>
		<%
 	String str_aid = request.getParameter("str_aid");
 	String selectedCategory = request.getParameter("category");
 	if(str_aid==null){ %>
	<script language=javascript>
				self.window.alert("접근할 수 없습니다.");
				location.href="Main.jsp?";
			</script>
<%}else{
 	int aid = Integer.parseInt(str_aid);
 	EquipmentDetail r = RentalHome.Detail(aid);
 	String m = (String)session.getAttribute("managerID");

 	if(m==null){ %>
	<script language=javascript>
				self.window.alert("권한이 없습니다.");
				location.href="Main.jsp?";
			</script>
<%}
 	%>
		<a href="giguan.jsp" class="btn btn-link btn-small">기자재관리<br></a>
>  기자재상세정보<br><br><br>
	<%
 	if(RentalHome.ESR(aid)!=null){
 	EMR g = RentalHome.ESR(aid);
	 if("삭제".equals(request.getParameter("cmd"))){
	%> <script language=javascript>
	self.window.alert("기자재를 삭제 할 수 없습니다.(대여중)");
	location.href="EquipmentDetail_m.jsp?str_aid=<%=r.get기자재번호()%>";
	</script> <% }%>
	
	<form name="EquipmentD" 	action="EquipmentDetail_m.jsp?str_aid=<%=r.get기자재번호()%>" method="POST">

		<div class="well">
			<font size = 7>
				<p class="text-error">대여중인 사용자 정보</p>
			</font>
		</div>
		<table class="table table-bordered">
			<tr>
				<td>이름</td>
				<td>사용자ID</td>
				<td>학과이름</td>
				<td>학번</td>
				<td>연락처</td>
				<td>대여기간</td>
				<td>대여분류</td>
			</tr>
			<tr>
				<td><%=g.get이름()%></td>
				<td><%=g.get사용자ID()%></td>
				<td><%=g.get학과이름()%></td>
				<td><%=g.get학번()%></td>
				<td><%=g.get연락처()%></td>
				<td><%=g.get대여기간()%></td>
				<td><%=g.get대여분류()%></td>
			</tr>
		</table>
		<%}
		else if(RentalHome.ESR(aid)==null){
				 if("삭제".equals(request.getParameter("cmd"))){
		String a = "비공개";
		String b = "삭제";
		RentalHome.delete(a, b, aid);
		%> 
	<script language=javascript>
	self.window.alert("기자재가 삭제되었습니다.");
	location.href="giguan.jsp";
	</script><%} %>
<form name="EquipmentD" 	action="EquipmentDetail_m.jsp?str_aid=<%=r.get기자재번호()%>" method="POST">
	 <%} %> 
		<table class="table table-bordered">
			<Tr>
				<td>카테고리명</td>
				<Td><%=r.get카테고리명()%></td>
			</tr>
			<tr>
				<td>모델명</td>
				<Td><%=r.get모델명()%></td>
			<tr>
				<td>기자재관리번호</td>
				<Td><%=r.get기자재관리번호()%></td>
			</tr>
			<tr>
				<td>학과이름</td>
				<Td><%=r.get학과이름()%></td>
			</tr>
			<tr>
				<td>보관사용처</td>
				<td><%=r.get보관사용처()%></td>
			</tr>
			<tr>
				<td>구매날짜</td>
				<td><%=r.get구매날짜()%></td>
			</tr>
			<tr>
				<td>구매금액</td>
				<td><%=r.get구매금액()%></td>
			</tr>
			<tr>
				<td>기자재상태</td>
				<Td><%=r.get기자재상태()%></td>
			</tr>
			<tr>
				<td>공개여부</td>
				<td><%=r.get공개여부()%></td>
			</tr>
			<tr>
				<td>비고</td>
				<td><%=r.get비고()%></td>
			</tr>
		</table>


		<p align="center">
			<a href="./giguan.jsp" name="cmd" class="btn btn-inverse">이전으로</a> 
			<a href="./EquipmentEdit.jsp?str_aid=<%=r.get기자재번호()%>" name="cmd" class="btn btn-inverse">수정</a>
			<input style="width: 50;" name="cmd" class="btn btn-inverse" type=submit value="삭제"> 
</form>

		</p>
		<%} %>
	</TD>
</TR>
<TR HEIGHT="100">
	<TD><%@ include file="./bottom.jsp"%></TD>
</TR>
</TABLE>
</body>
</html>